//
//  String+Extension.swift
//  CSYMicroBlockSina
//
//  Created by 姚彦兆 on 15/11/17.
//  Copyright © 2015年 姚彦兆. All rights reserved.
//

import UIKit

extension NSString {

    //文件缓存
    func appendDocumentPath () -> NSString {
    
        let path : NSString = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true).last!
        
        
        return path.stringByAppendingPathComponent(self.lastPathComponent)
    
    }
    
    //沙盒缓存
    func appendCachePath () -> NSString {
    
        let path : NSString = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.CachesDirectory, NSSearchPathDomainMask.UserDomainMask, true).last!
        
        return path.stringByAppendingPathComponent(self.lastPathComponent)
    
    }
    
    //TMP缓存

    func appendTempPath () -> NSString {
    
        let path : NSString = (NSTemporaryDirectory() as NSString).stringByAppendingPathComponent(self.lastPathComponent)
        
        return path
    
    }
    
//    - (NSString *)appendDocumentPath {
//    
//    NSString *dir = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).lastObject;
//    
//    return [dir stringByAppendingPathComponent:self.lastPathComponent];
//    
//    }
//    
//    - (NSString *)appendCachePath {
//    
//    NSString *dir = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).lastObject;
//    
//    return [dir stringByAppendingPathComponent:self.lastPathComponent];
//    
//    }
//    
//    - (NSString *)appendTempPath {
//    
//    return [NSTemporaryDirectory() stringByAppendingPathComponent:self.lastPathComponent];
//    
//    }



}